package com.ctsi.ssdc.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Calendar;
import java.util.Date;

/**
 * 高新技术产业
 */
@Data
public class HighTechIndustry {
    /**
     * id
     */
    private Long id;

    /**
     * 当月
     */
    private double thisMonth;

    /**
     * 当月止累计
     */
    private double accumulate;

    /**
     * 同比
     */
    private double MonthOnMonth;

    /**
     * 高新占比
     */
    private double HighTechRatio;
    /**
     * 高新占比1
     */
    private double HighTechRatio1;
    /**
     * 高新占比2
     */
    private double HighTechRatio2;

    /**
     * 日期
     */
    @JsonFormat(pattern = "yyyy-MM",timezone = "GMT+8")
    @DateTimeFormat(pattern="yyyy-MM")
    private Date statisticalTime;


    /**
     * @return year 年份
     */
    public int getYear(){
        Calendar calender = Calendar.getInstance();
        calender.setTime(this.statisticalTime);
        int year = calender.get(Calendar.YEAR);
        return year;
    }


    /**
     * @return month 月份
     */
    public int getMonth(){
        Calendar calender = Calendar.getInstance();
        calender.setTime(this.statisticalTime);
        int month = calender.get(Calendar.MONTH) + 1;
        return month;
    }
}
